<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>天祥瑞饲料</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" id="viewport"
	content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<link href="./css/distribute.css" rel="stylesheet" type="text/css">
<link href="./css/reset.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
</head>
<body>
	<div style="margin: 3.25rem 0;">
		<!--头部开始-->
		<div class="header">
			<a href="javascript:history.back()" class="left"></a>
			<p class="headerText">我要分销</p>
		</div>
		<div style="margin: 3.25rem 0;">
			<div class="MpToDistributeKnow">
				<h5>【<span>分销须知</span>】</h5>
				<p>1、仅需一步即可申请成为分销商。</p>
				<!-- <p>2、您的会员名称是：{{num}}</p> -->
				<p>2、您的推荐人是：<font style="color: red !important;" class="parentName"><%=request.getSession().getAttribute("distributionName")%></font></p>
				<input type="text" id="name" placeholder="请输入微店名称" style="color:#eaad43;user-select: all;box-sizing: unset;">
			</div>
			<div class="MpToDistributeBottomTab">
				<a>
					<button type="button" onclick="joinDistribute()">确认成为分销商</button>
				</a>
			</div><!--底部栏 -->
		</div>
	</div>
	
	
	<script type="text/javascript">
	
		$.post("IsDistributor.do",function(res){
			
			if (res.type == 0) {
				
				window.location.href = "distribute1.jsp?id="+res.data;
			}
			
		},"json")
	
		function joinDistribute() {
			if($("#name").val() == "") {
				layer.msg("请输入微店名称！");
				return;
			}
			$.post("insertDistr.do?name="+$("#name").val(), function(data) {
				if (data.type == 1) {
					layer.msg("申请成功，恭喜你成为分销商！");
					setTimeout(function(){
						window.location.href = "distribute1.jsp";
					}, 1000);
				}
			}, "json");
		}
		
	</script>
</body>
</html>